package com.itheima.comment.repository;

import com.itheima.comment.document.Comment;
import org.springframework.data.mongodb.repository.MongoRepository;
import org.springframework.stereotype.Component;

import java.util.List;

/**
 * @Repository @service @controller
 *
 * <Comment,String>  comment 用于指定 要操作的POJO 对应的collection； String 指定 主键的数据类型
 * @version 1.0
 * @description 标题
 * @package com.itheima.comment.repository
 */
public interface CommentRepository extends MongoRepository<Comment,String> {
    //我要根据userId=2的值进行查询 select * from xx where userId=2 order by likes desc

    public List<Comment> findByUserIdOrderByLikesDesc(Integer userId);
}
